<template>
  <div class="page-miH page-bgBack check-box">
    <a-tabs :activeKey="componentName" @change="v => (componentName = v)">
      <a-tab-pane :key="item.type" v-for="item in numArr">
        <span slot="tab">
          <a-badge :count="item.num" :offset="[5, -2]">{{ item.name }}</a-badge>
        </span>
      </a-tab-pane>
    </a-tabs>
    <div :is="componentName"></div>
  </div>
</template>

<script>
import checkCard from "./card";
import imports from "./workingHours";
export default {
  components: {
    checkCard,
    imports
  },
  data() {
    return {
      componentName: "checkCard",
      numArr: [
        { type: "checkCard", name: "考勤打卡表", num: 0 },
        { type: "imports", name: "工时导入表", num: 0 }
      ]
    };
  },
  created() {
    if (this.$store.state.check.componentName) {
      this.componentName = this.$store.state.check.componentName;
      this.$store.commit("check/componentName", null);
    }
  }
};
</script>

<style lang="scss" scoped>
.check-box {
  padding: 0 24px 24px 24px;
  ::v-deep.ant-tabs-tab {
    line-height: 60px;
    padding-top: 0px;
    height: 60px;
  }
  ::v-deep.ant-tabs-bar {
    margin-bottom: 16px !important;
  }
}
</style>
